
<div class="alert-bg"></div>

<div class="register-wrap" id="register-wrap">
    <ul class="title fix">
        <li class="li active">游客注册</li>
        <li class="li">玩伴注册</li>
    </ul>
    <em class="close-box" onclick="hideBox($('.register-wrap'), $('.alert-bg'));"></em>

    <form class="visitor reg-tab" style="display: block;"  onsubmit="return enter_submit_visitor_reg();" method="post">
        <p class="prompt"></p>
        <div class="visitor-mail-reg fix" style="display:none;">
        <input required type="email" class="email" placeholder="电子邮件地址" style="margin-top: 10px;">
        <input required type="password" class="shuru-psd" placeholder="登陆密码">
        <input required type="password" class="queren-psd" placeholder="确认密码">
        <p class="code-wrap fix">
            <input required type="text" class="code" placeholder="验证码">
            <img  class="scode" src="/checkcode">
            <img class="refresh" src="/resource/www/imgs/refresh.png" onclick="flush_register_code()" >
        </p>
        <p class="switch_reg" onclick="switch_reg(this)">使用手机号码注册</p>
        </div>

        <div class="visitor-phone-reg fix">
        <select name="areacode" id="areacode_visitor">
            <option value="+86">中国(+86)</option>
            <option value="+33">法国(+33)</option>
        </select>
        <input required type="text" id="num_visitor"  placeholder="手机号码，法国号码请去掉首位数字0">
        <p class="code-wrap fix">
            <input required type="text" id="sms_code_visitor" class="sms_code_visitor" placeholder="短信验证码">
            <input class="scode duanx-code" name="" onclick="getCode(this,'tourist')" type="button" value="发送验证码">
        </p>
        
        <input required type="password" class="shuru-psd" placeholder="登陆密码">
        <input required type="password" class="queren-psd" placeholder="确认密码">
        <p class="code-wrap fix">
            <input required type="text" class="code" placeholder="验证码">
            <img  class="scode" src="/checkcode">
            <img class="refresh" src="/resource/www/imgs/refresh.png" onclick="flush_register_code()">
        </p>
        <p class="switch_reg" onclick="switch_reg(this)">使用个人邮箱注册</p>
        </div>

        <label class="label">
            <input checked type="checkbox" class="checkbox">
            <span class="text">我已阅读并同意哇吖服务<a href="/service/howto_bzxy" target="_blank" class="pact">注册协议</a>及<a href="/service/howto_bzxy/#t3" target="_blank" class="provision">隐私条款</a></span>
        </label>
        <input type="submit" class="submit" value="注册为游客" onclick="return submit_visitor_reg();">
        <p class="other">已经是哇吖会员？<span class="click-login" onclick="change_box($('.register-wrap'), $('.login-wrap'));">登陆</span></p>
    </form>

    <form class="guide reg-tab" onsubmit="return enter_submit_guide_reg();" method="post">
        <p class="prompt"></p>
        <p class="sex fix"  style="margin-top: 10px;">
            <span class="left">性别</span>
            <label class="boy"><input type="radio" checked name="sex" id="" value="m"><span>男生</span></label>
            <label class="girl"><input type="radio"  name="sex" id="" value="f"><span>女生</span></label>
        </p>
        <input class="xing" required type="text" placeholder="姓氏">
        <input class="ming" required type="text" placeholder="名字">
        <input class="email" required type="email" placeholder="电子邮件地址">
        <input class="shuru-psd" required type="password" placeholder="登陆密码">
        <input class="queren-psd" required type="password" placeholder="确认密码">
        <select name="areacode" id="areacode">
            <option value="+86">中国(+86)</option>
            <option value="+33">法国(+33)</option>
        </select>
        <input required type="text" id="num"  placeholder="手机号码，如果号码首位数字为0去掉数字0">
        <p class="code-wrap fix">
            <input required type="text" id="sms_code" class="sms_code" placeholder="短信验证码">
            <input class="scode duanx-code" name="" onclick="getCode(this,'guider')" type="button" value="发送验证码">
        </p>

        <p class="code-wrap fix">
            <input required type="text" class="code" placeholder="验证码">
            <img  class="scode" src="/checkcode">
            <img class="refresh" src="/resource/www/imgs/refresh.png" onclick="flush_register_code()">
        </p>

        <label class="label">
            <input checked type="checkbox" class="checkbox">
            <span class="text">我已阅读并同意哇吖服务<a href="/service/howto_bzxy" target="_blank" class="pact">注册协议</a>及<a href="/service/howto_bzxy/#t3" target="_blank" class="provision">隐私条款</a></span>
        </label>
        <input type="submit" class="submit" value="注册为玩伴" onclick="return submit_guide_reg();">
        <p class="other">已经是哇吖会员？<span class="click-login" onclick="change_box($('.register-wrap'), $('.login-wrap'));">登陆</span></p>
    </form>
</div>

<div class="login-wrap" id="login-wrap">
    <ul class="title fix">
        <li class="li active">游客登陆</li>
        <li class="li">玩伴登陆</li>
    </ul>
    <em class="close-box" onclick="hideBox($('.login-wrap'), $('.alert-bg'));"></em>
    <form class="visitor login-tab" style="display: block;"  onsubmit="return enter_submit_login();" method="post">
        <p class="info">用合作网站账号登陆</p>
        <ul class="three-api fix">
            <li class="three-li">
                <a href="/openlogin/login/sina?type=tourist" class="a">
                    <img src="/resource/www/imgs/three_sina.png">
                </a>
            </li>
            <li class="three-li">
                <a href="/openlogin/login/qq?type=tourist" class="a">
                    <img src="/resource/www/imgs/three_qq.png">
                </a>
            </li>
            <li class="three-li">
                <a href="/openlogin/login/wechat?type=tourist" class="a">
                    <img src="/resource/www/imgs/three_wechat.png">
                </a>
            </li>
        </ul>
        <p class="text">使用哇吖账户登录</p>
        <p class="prompt"></p>
        <input required type="email" id="tourist_mail" class="email" placeholder="邮箱/手机号码">
        <input required type="password" class="shuru-psd" placeholder="密码">
    <!--    <p class="code-wrap fix">
            <input required type="text" class="code" placeholder="验证码">
            <img src="/checkcode" onclick="this.src='/checkcode?'+new Date().getTime();" class="i-code" id="code1">
            <span class="again" onclick="flush_code()">看不清<br>换一张</span>
        </p>-->
        <p class="point">快速、免费又安全更快速的预订,修改预订个性化设置您的个人页面</p>
        <input type="submit" class="submit" value="游客登陆" onclick="return submit_login($('.login-wrap').find('.visitor'),'tourist');">
        <p class="other"><a class="zh-psd" href="/homepage/reset_pwd">找回密码？</a>还没有账号？<span class="click-reg" onclick="change_box($('.login-wrap'), $('.register-wrap'));">注册</span></p>
    </form>
    <form class="guide login-tab" onsubmit="return enter_submit_login();" method="post">
       <!-- <p class="info">用合作网站账号登陆</p>
        <ul class="three-api fix">
            <li class="three-li">
                <a href="/openlogin/login/sina?type=guider" class="a">
                    <img src="/resource/www/imgs/three_sina.png">
                </a>
            </li>
            <li class="three-li">
                <a href="/openlogin/login/qq?type=guider" class="a">
                    <img src="/resource/www/imgs/three_qq.png">
                </a>
            </li>
            <li class="three-li">
                <a href="/openlogin/login/wechat?type=guider" class="a">
                    <img src="/resource/www/imgs/three_wechat.png">
                </a>
            </li>
        </ul>
        <p class="text">使用哇吖账户登录</p>-->
        <p class="prompt"></p>
        <input required type="email" id="guider_mail" class="email" placeholder="邮箱/手机号码">
        <input required type="password" class="shuru-psd" placeholder="密码">
    <!--    <p class="code-wrap fix">
            <input required type="text" class="code" placeholder="验证码">
            <img src="/checkcode"  onclick="this.src='/checkcode?'+new Date().getTime();" class="i-code">
            <span class="again" onclick="flush_code()">看不清<br>换一张</span>
        </p>-->
        <p class="point">快速、免费又安全更快速的预订,修改预订个性化设置您的个人页面</p>
        <input type="submit" class="submit" value="玩伴登陆"  onclick="return submit_login($('.login-wrap').find('.guide'),'guider');">
        <p class="other"><a class="zh-psd" href="/homepage/reset_pwd">找回密码？</a>还没有账号？<span class="click-reg" onclick="change_box($('.login-wrap'), $('.register-wrap'));">注册</span></p>
    </form>
</div>

<script>
function switch_reg(item){
	$("#register-wrap .visitor div:hidden").show();
        $(item).parent().hide();
}
function getCode(current,type){
        if(type=="guider"){
        var areacode = $("#areacode").val();
        var num = $.trim($("#num").val());
        }else{
    	    var areacode = $("#areacode_visitor").val();
            var num = $.trim($("#num_visitor").val());
    	}
        if (!num) {
            layer.msg("手机号码不能为空");
            return false;
        }

        var i = 60;
        var timer = null;
        timer = setInterval(function() {
            i--;

            if (i < 10) {
                i = '0' + i;
            }

            $(current).val('剩余' + i + 's');
            $(current).attr('disabled', true);

            if (i <= 0) {
                clearInterval(timer);
                $(current).val('再次获取');
                $(current).attr('disabled', false);
                i = 60;
            }
        }, 1000);

        var phoneNum=""+areacode+num;
        /* 判断手机号码所属地区 */
        var area='';
        if (areacode == '+86')
        {
            area='CN';
        }else{area='FOREIGN'}
        
        var url = "/user/send_msg";
        $.post(url,{phoneNum:phoneNum, area:area},function(o){
        	if(o.status==0){
        		layer.msg("验证码发送成功");
            }else{
                layer.msg("验证码发送失败，稍后再试");
            }      	
        },'json');

    }

    function send_email(type){
        if(type=='tourist'){
             var mail = $("#tourist_mail").val();
        }else{
             var mail = $("#guider_mail").val();
        }
        $.post('/user/mail',{data:mail},function(data){
            layer.msg(data);
        });
    }

</script>
